package com.thinkfit.jy.adapter;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.common.lib.bean.BannerBean;
import com.common.lib.utils.BaseUtils;
import com.common.lib.view.banner.ViewHolder;
import com.thinkfit.jy.R;

public class BannerViewHolder implements ViewHolder<BannerBean> {
    private Context mContext;
    private View view;

    @Override
    public View createView(Context context) {
        mContext = context;
        view = LayoutInflater.from(context).inflate(R.layout.item_banner, null);
        view.findViewById(R.id.iv).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ((Activity) context).finish();
            }
        });
        return view;
    }


    @Override
    public void onBind(Context context, int position, BannerBean bean) {
        BaseUtils.StaticParams.loadImage(mContext, 0, bean.getUrl(), view.findViewById(R.id.iv));
    }
}
